package com.xja.wechat.pay;

import com.github.wxpay.sdk.WXPayConfig;
import com.xja.wechat.common.Constant;

import java.io.*;

public class MyWXPayConfig implements WXPayConfig {

    private byte[] certData;

    public MyWXPayConfig() {
        //读取我们的证书
        String certPath = "E:\\cert\\apiclient_cert.p12";
        File file = new File(certPath);
        FileInputStream fileInputStream = null;
        try {
            fileInputStream = new FileInputStream(file);
            this.certData = new byte[(int) file.length()];
            fileInputStream.read(this.certData);
            fileInputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    @Override
    public String getAppID() {
        return "wxc37f01894579f97b";
    }

    @Override
    public String getMchID() {
        return "1519853611";
    }

    @Override
    public String getKey() {
        return "1234567890asdfghjklzxcvbnmqwerty";
    }

    @Override
    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        return 0;
    }

    @Override
    public int getHttpReadTimeoutMs() {
        return 0;
    }
}
